<template>
  <div>

    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/systems' }">业务系统</el-breadcrumb-item>
      <el-breadcrumb-item>新增系统</el-breadcrumb-item>
    </el-breadcrumb>

    <el-row style="margin-top: 22px;padding-top:22px;border-top: 1px solid lightgrey;">
      <el-col :span="12">
        <el-form ref="form" :model="form" label-width="6rem">
          <el-form-item label="业务编码">
            <el-input v-model="form.sysCode"></el-input>
          </el-form-item>
          <el-form-item label="业务名称">
            <el-input v-model="form.sysName"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">保存</el-button>
            <el-button @click="onCancle">取消</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>

  </div>
</template>

<style>
</style>

<script>
import { mapActions } from "vuex";

export default {
  name: "AddSystem",
  data() {
    return {
      form: {
        sysCode: this.sysCode,
        sysName: this.sysName,
      }
    };
  },
  methods: {
    ...mapActions(["reqInsertSystem"]),
    onSubmit() {
      console.log("submit!");
      var payload = {
        sysCode: this.form.sysCode,
        sysName: this.form.sysName,
      };
      this.reqInsertSystem(payload);
    },
    onCancle() {
      this.$router.go(-1);
    }
  }
};
</script>
